package sevensoft.创建型模式.单例模式.饿汉式;

import java.io.Serializable;

public class Singleton implements Serializable {

    private static boolean flag;

    private Singleton(){
        if ( flag )
            throw new RuntimeException("别乱搞哦，不让你破坏单例模式");
        flag=true;
    }

    private static final Singleton singleton = new Singleton();

    public static Singleton getInstance(){
        return singleton;
    }
}
